package com.seminario.gson;

import com.google.gson.Gson;
import com.seminario.dao.RegistroDao;
import com.seminario.model.Registro;

public class Prueba {

	public static void main(String[] args) {
		
		Registro registro;
		RegistroDao regristosDao = new RegistroDao();
		registro = regristosDao.getRecordById(20);
		
		System.out.println(registro);
		
		Gson gson = new Gson();
		
		String cadenaJson = gson.toJson(registro);
		
		System.out.println("Fromato JSON: " + cadenaJson);
		
		System.out.println("reconvertir");
		
		Registro fromJson = gson.fromJson(cadenaJson, Registro.class);
		
		System.out.println(fromJson);
	}

}
